<style>
.reader_content {position:fixed; top:72px; left:11%; right:11%; bottom:20px; padding:10px; font-size:14px; line-height:150%; background-color:#FFF; overflow:auto;}

.big_save {display:inline-block; padding:2px 15px; font-size:20px; margin:0px 0 0 20px; background-color:#85A749; color:#FFF; border:1px solid #666; white-space:nowrap; font-family:微软雅黑,黑体; cursor:pointer;}

.select_name {display:inline-block; font-size:14px; background-color:transparent; margin:5px 10px 0 0; padding:5px; text-decoration:underline; cursor:pointer;}

</style>
<div class="corner_all" style="position:fixed; top:10px; left:10%; right:10%; bottom:10px; background-color:#EEE; border:1px solid #CCC;">
	<a style="float:right;" onclick="UM_LAYER.close();"><img src="/images/reader_close.png"></a>
		<div style="margin:10px 10px 0px 30px; height:80px;">
			<div style="float:right; width:270px; text-align:left;">
				<a id="save_btn" class="big_save" onclick="in_site_save();">转存 / 推荐给好友</a>
			</div>
			<div style="margin:0 290px 0 0;">
				<div id="title">
					<span style="display:block; font-size:20px; height:24px; line-height:24px; color:#000; word-break:break-all; overflow:hidden; font-family:微软雅黑,黑体;">
						<{$t}>
					</span>
				</div>
				<a href="<{$article.url}>" target="_blank" style="display:block; font-size:12px; height:14px; margin-top:5px; word-break:break-all; overflow:hidden;">
					<{$u}>
				</a>
			</div>
		</div>
		<div  class="reader_content corner_all" id="in_site_save_body">
			<div style="margin:0 20px; padding:10px 0px 5px 0px; border-bottom:1px dotted #CCC; min-height:40px;">
				<div style="float:left; text-align:right; width:100px; color:#777777; padding:10px 0 0 0;">
					保存到阅读圈：
				</div>
				<div id="uReadMeCirclesList" style="margin:0 0 0 110px;">
					<{if $circles}>
						<{section name=i loop=$circles}>
							<{if $circles[i].privacy == 'private'}>
								<a class="select_name" uReadMeInId="<{$circles[i].id}>" uReadMeColor="#851" uReadMeSBG="#D82" style="color:#851;"><{$circles[i].title}></a>
							<{else}>
								<a class="select_name" uReadMeInId="<{$circles[i].id}>" uReadMeColor="#069" uReadMeSBG="#69F" style="color:#069"><{$circles[i].title}></a>
							<{/if}>
						<{/section}>
						
						<a id="uReadMeNewCircleA" onclick="$(this).hide(); $('#uReadMeNewCircleDiv').css({'display':'inline-block'});" style="display:inline-block; font-size:12px; color:#060; margin:5px 10px 1px 0; padding:5px; text-decoration:none;">+新建阅读圈</a>
						<div id="uReadMeNewCircleDiv" style="display:none; border:1px solid #EEE; background-color:#FAFAFA; padding:5px 10px;">
							<input type="text" id="uReadMeNewCircleName" name="uReadMeNewCircleName" maxlength="20" style="width:110px; font-size:14px; border:1px solid #AAA; padding:2px; vertical-align:middle;">
							<input id="uReadMeNewCircleIsPrivate" type="checkbox" value="1" style="margin:0; padding:0; vertical-align:middle;">
							<span onclick="$('#uReadMeNewCircleIsPrivate').prop('checked', !$('#uReadMeNewCircleIsPrivate').prop('checked'));" style="margin:0; padding:0; cursor:pointer; vertical-align:middle;">私有</span>
							
							<input id="uReadMeNewCircleSubmit" type="button" value="确定" onclick="show_new_name();" style="margin-left:20px; vertical-align:middle;">
							<a id="uReadMeNewCircleCancle" onclick="$('#uReadMeNewCircleName').val(''); $('#uReadMeNewCircleDiv').hide(); $('#uReadMeNewCircleA').show();" style="margin-left:10px; vertical-align:middle;">取消</a>
						</div>
						<script type="text/javascript">
						function show_new_name() {
							var val = $('#uReadMeNewCircleName').val();
							if (val) {
								$('#uReadMeNewCircleDiv').hide(); 
								$('#uReadMeNewCircleA').hide();

								$('#uReadMeNewCircleA').after(
									$('<a class="select_name" style="background-color:'+(($('#uReadMeNewCircleIsPrivate').prop('checked')) ? '#D82' : '#69F')+'; color:#FFF;">'+val+'</a>').click( function () {
										$('#uReadMeNewCircleName').val('');
										$('#uReadMeNewCircleIsPrivate').prop('checked', false);
										$('#uReadMeNewCircleA').show();
										$(this).remove();
									} )
								);
							} else {
								$('#uReadMeNewCircleDiv').hide(); 
								$('#uReadMeNewCircleA').show();
							}
						}
						</script>
					<{else}>
						<div id="uReadMeNewCircleDiv" style="display:inline-block; border:1px solid #EEE; background-color:#FAFAFA; padding:5px 10px;">
							<input type="text" id="uReadMeNewCircleName" name="uReadMeNewCircleName" maxlength="20" style="width:110px; font-size:14px; border:1px solid #AAA; padding:2px; vertical-align:middle;">
							<input id="uReadMeNewCircleIsPrivate" type="checkbox" value="1" style="margin:0; padding:0; vertical-align:middle;">
							<span onclick="$('#uReadMeNewCircleIsPrivate').prop('checked', !$('#uReadMeNewCircleIsPrivate').prop('checked'));" style="margin:0; padding:0; cursor:pointer; vertical-align:middle;">私有</span>
						</div>
					<{/if}>
				</div>
			</div>
			<div style="margin:0 20px; padding:10px 0px 5px 0px; border-bottom:1px dotted #CCC; min-height:40px;">
				<div style="float:left; text-align:right; width:100px; color:#777777; padding:10px 0 0 0;">
					推荐给好友：
				</div>
				<div id="uReadMeFriendsList" style="margin:0 0 0 110px;">
					<{section name=i loop=$friends}>
						<a class="select_name" uReadMeInId="<{$friends[i].friend_id}>" uReadMeColor="#069" uReadMeSBG="#69F" style="color:#069">
							<{$friends[i].nickname}>
						</a>
					<{/section}>
				</div>
			</div>
		</div>
</div>
<script language="javascript" type="text/javascript">
$('.select_name').click( function () {
	if ($(this).attr('uReadMeInId') != 'undefined') {
		if (color2hex($(this).css('backgroundColor')) == 'transparent') {
			$(this).css({'backgroundColor':$(this).attr('uReadMeSBG'), 'color':'#FFF'});
		} else {
			$(this).css({'backgroundColor':'transparent', 'color':$(this).attr('uReadMeColor')});
		}
	}
} );


	function in_site_save () {
		var c = '';
		$('#uReadMeCirclesList .select_name').each( function(){
			if ($(this).attr('uReadMeInId') != 'undefined' && color2hex($(this).css('backgroundColor')) != 'transparent') {
				c += $(this).attr('uReadMeInId') + ',';
			}
		} );
		var f = '';
		$('#uReadMeFriendsList .select_name').each( function(){
			if ($(this).attr('uReadMeInId') != 'undefined' && color2hex($(this).css('backgroundColor')) != 'transparent') {
				f += $(this).attr('uReadMeInId') + ',';
			}
		} );
		
		var cp = ($('#uReadMeNewCircleIsPrivate').prop('checked')) ? '1' : '';
		var cn = $('#uReadMeNewCircleName').val();
		
		if (c || cn) {
			$('#in_site_save_body').html('<div style="padding:100px 0 0 0; font-size:28px; font-family:微软雅黑,黑体; text-align:center; color:#ACF;">操作中......</div>');
			$('#save_btn').hide();
			cn = encodeURIComponent(cn);
			
			loadMod('reader/action_save', {'article_type':'<{$article_type}>', 'id':<{$id}>, 'c':c, 'f':f, 'cn':cn, 'cp':cp}, '', function (msg) {
				if (msg == 'true') {
					$('#in_site_save_body').html('<div style="padding:100px 0 0 0; font-size:28px; font-family:微软雅黑,黑体; text-align:center; color:#ACF;">保存成功！</div>');
				} else {
					$('#in_site_save_body').html('<div style="padding:100px 0 0 0; font-size:28px; font-family:微软雅黑,黑体; text-align:center; color:#FA6;">保存失败！</div>');
				}
			} );

		} else {
			alert('请选择一个圈子！');
		}
	}
</script>
